package org.lisa.crm.service.impl;

import org.lisa.crm.dao.ReportDao;
import org.lisa.crm.model.Customer;
import org.lisa.crm.model.CustomerServe;
import org.lisa.crm.model.Report;
import org.lisa.crm.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by admin on 2018/2/4.
 */

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private ReportDao reportDao;


    @Override
    public List<Report> queryCustomersContribution(String customerName) {

        return reportDao.queryCustomersContribution(customerName);

    }

    @Override
    public Map<String, Object> queryCustomersGc() {

        List<Report> list = reportDao.queryCustomersGc();

        List<String> level=new ArrayList<>();

        List<Integer> count=new ArrayList<>();

        for(Report r: list){
            level.add(r.getLevel());
            count.add(r.getCount());
        }

        Map<String,Object> map=new HashMap<>();

        map.put("code",200);
        map.put("level",level);
        map.put("count",count);

        return map;
    }

    @Override
    public Map<String, Object> queryCustomersServerAnalysis() {

        List<CustomerServe> list=reportDao.queryCustomersServerAnalysis();
        /*
                (data.code == '200') {
				var Legend = data.Legend;
				var customerServer = data.customerServer;
         */
        List<>



    }


}
